<?php
class mailLayer {
	public function send( OTS_Account $Account, $Subject, $Body)
	{
		if( !Kernel::layer('OTS')->getConfig('mail_host') )
		{
			return false;
		}
		require 'lib/phpmailer/class.phpmailer.php';
		$Mail = new PHPMailer();

		$Mail->From = Kernel::layer('OTS')->getConfig('mail_name');
		$Mail->FromName = Kernel::layer('OTS')->getConfig('servername');
		$Mail->Host = Kernel::layer('OTS')->getConfig('mail_host');
		$Mail->Port = Kernel::layer('OTS')->getConfig('mail_port');
		$Mail->Mailer = "smtp";
		$mail->Username = Kernel::layer('OTS')->getConfig('mail_username');
		$mail->Password = Kernel::layer('OTS')->getConfig('mail_password');
		$Mail->SMTPAuth = true;
		$Mail->Subject = $Subject;

		$Mail->Body = $Body;
		$Mail->AddAddress( $Account->eMail, '' );

		if( !$Mail->Send() )
		{
			return false;
		}

		$Mail->ClearAddresses();
		$Mail->ClearAttachments();

		return true;
	}
}
?>